package br.ufmg.ubicomp.droidguide.eventservice.management;

import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;

import br.ufmg.ubicomp.droidguide.eventservice.DroidGuideRemoteService;

/**
 * service to event mapping
 * @author wpjr
 *
 */
public class ServiceConfiguration {

	private Map<String, Collection<DroidGuideRemoteService>> eventToServicesMap;

	public ServiceConfiguration() {
		eventToServicesMap = new HashMap<String, Collection<DroidGuideRemoteService>>();
	}
	
	public Map<String, Collection<DroidGuideRemoteService>> getEventToServicesMap() {
		return eventToServicesMap;
	}

	/**
	 * adds an entry to event to service mapping
	 * @param eventId event id
	 * @param service service
	 */
	public void addEventToServicesMap(String eventId, DroidGuideRemoteService service) {
		if (eventToServicesMap.get(eventId) == null)
		{
			eventToServicesMap.put(eventId, new HashSet<DroidGuideRemoteService>());
		}
		eventToServicesMap.get(eventId).add(service);
	}
	
	/**
	 * returns the event IDs
	 * @return the list of event IDs
	 */
	public Collection<String> getEventIds()
	{
		return eventToServicesMap.keySet();
	}
}
